﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;

namespace TodayWhoModel
{
    public class Mailer
    {
        private static void SendEmail(string sendTo, string sendFrom, string sendSubject, string sendMessage)
        {
            try
            {
                // create the email message
                MailMessage message = new MailMessage(
                   sendFrom,
                   sendTo,
                   sendSubject,
                   sendMessage);

                message.IsBodyHtml = true;
                // create smtp client at mail server location
                SmtpClient client = new SmtpClient();
                //client.EnableSsl = true;


                // send message
                client.Send(message);
            }
            catch (Exception ex)
            {

            }
        }

        public static void SendWelcomeEmail(string to)
        {
            string from = "info@todaywho.com";
            string subject = "TodayWho";
            string body = "<div style='margin-top:40px;font-size:22px'> TodayWho'ya kayit oldugunuz icin tesekkur ederiz." + "</div>";
            SendEmail(to, from, subject, body);
        }

        public static void SendPasswordRecoveryEmail(string to, string password)
        {
            string from = "info@todaywho.com";
            string subject = "Password Recovery - TodayWho";
            string body = "<div style='margin-top:40px;font-size:22px'> Your new password is : " + password + "</div>";
            body += "<div>You can click <a href='http://www.todaywho.com'> here</a> to login Todaywho..</div>";

            SendEmail(to, from, subject, body);
        }

        public static void SendActivationEmail(string to, string activationKey)
        {
            string link = "http://www.appgreedy.com/activation.aspx?m=" + to + "&k=" + activationKey;
            string from = "reply@appgreedy.com";
            string subject = "Account Activation - Appgreedy";
            string body = "<div style='margin-top:40px;font-size:22px'> Thank you for registering AppGreedy. To activate your account and start to test applications and earn cash, please click the following link : </div>";
            body += "<div><a href=" + link + "> Click here </a> to activate your account in AppGreedy..</div>";

            SendEmail(to, from, subject, body);
        }
    }
}
